
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>This、Apply、Call、Bind · 记录技术文档内容</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zhengyuliang">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="前端js常用的60余种工具方法.html" />
    
    
    <link rel="prev" href="javascript核心知识.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">CSS</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../CSS/18种CSS命名和书写规范.html">
            
                <a href="../CSS/18种CSS命名和书写规范.html">
            
                    
                    18种CSS命名和书写规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../CSS/灵活运用CSS开发技巧.html">
            
                <a href="../CSS/灵活运用CSS开发技巧.html">
            
                    
                    灵活运用CSS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../CSS/自适应 flex grid.html">
            
                <a href="../CSS/自适应 flex grid.html">
            
                    
                    自适应 Flex Grid
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">HTML</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                <a href="../HTML/浏览器里的本地数据库：IndexedDB.html">
            
                    
                    浏览器里的本地数据库：IndexedDB
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Vue</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../Vue/7个有用的Vue开发技巧.html">
            
                <a href="../Vue/7个有用的Vue开发技巧.html">
            
                    
                    7个有用的Vue开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                <a href="../Vue/Vue this.$router.push、replace、go的区别.html">
            
                    
                    Vue This.$Router.Push、Replace、Go的区别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                <a href="../Vue/Vue 的父组件和子组件生命周期钩子函数执行顺序？.html">
            
                    
                    Vue 的父组件和子组件生命周期钩子函数执行顺序？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../Vue/Vue.set和this.$set应用的场景.html">
            
                <a href="../Vue/Vue.set和this.$set应用的场景.html">
            
                    
                    Vue.Set和This.$Set应用的场景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../Vue/vue高级技巧.html">
            
                <a href="../Vue/vue高级技巧.html">
            
                    
                    Vue高级技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                <a href="../Vue/从 0 开始手把手带你搭建一套规范的 Vue3.x 项目工程环境.html">
            
                    
                    从 0 开始手把手带你搭建一套规范的 Vue3.X 项目工程环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                <a href="../Vue/浅析 vue-router 源码和动态路由权限分配.html">
            
                    
                    浅析 Vue Router 源码和动态路由权限分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../Vue/父组件监听到子组件的生命周期.html">
            
                <a href="../Vue/父组件监听到子组件的生命周期.html">
            
                    
                    父组件监听到子组件的生命周期
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                <a href="../Vue/理解Vue.mixin，利用Vue.mixin正确的偷懒.html">
            
                    
                    理解Vue.Mixin，利用Vue.Mixin正确的偷懒
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">JavaScript</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="5个技巧让你更好的编写 JavaScript(ES6">
            
                <span>
            
                    
                    5个技巧让你更好的编写 JavaScript(ES6) 中条件语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="5种常见函数的写法和调用方式.html">
            
                <a href="5种常见函数的写法和调用方式.html">
            
                    
                    5种常见函数的写法和调用方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="7道javascript题，让你理解基本的javascript.html">
            
                <a href="7道javascript题，让你理解基本的javascript.html">
            
                    
                    7道Javascript题，让你理解基本的Javascript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="Array.from(">
            
                <span>
            
                    
                    Array.From() 五个超好用的用途
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="ES6汇总资料.html">
            
                <a href="ES6汇总资料.html">
            
                    
                    ES6汇总资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="JS开发必须知道的41个技巧.html">
            
                <a href="JS开发必须知道的41个技巧.html">
            
                    
                    JS开发必须知道的41个技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="JavaScript之防抖Debounce和节流Throttle.html">
            
                <a href="JavaScript之防抖Debounce和节流Throttle.html">
            
                    
                    JavaScript之防抖Debounce和节流Throttle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="JavaScript数组求并集，交集和差集.html">
            
                <a href="JavaScript数组求并集，交集和差集.html">
            
                    
                    JavaScript数组求并集，交集和差集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="JavaScript的优雅写法.html">
            
                <a href="JavaScript的优雅写法.html">
            
                    
                    JavaScript的优雅写法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="axios知识点.html">
            
                <a href="axios知识点.html">
            
                    
                    Axios知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="javascript核心知识.html">
            
                <a href="javascript核心知识.html">
            
                    
                    Javascript核心知识
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="4.12" data-path="this、apply、call、bind.html">
            
                <a href="this、apply、call、bind.html">
            
                    
                    This、Apply、Call、Bind
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="前端js常用的60余种工具方法.html">
            
                <a href="前端js常用的60余种工具方法.html">
            
                    
                    前端Js常用的60余种工具方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="前端异常的捕获与处理.html">
            
                <a href="前端异常的捕获与处理.html">
            
                    
                    前端异常的捕获与处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.15" data-path="在 JavaScript 中交换值的 10 种方法.html">
            
                <a href="在 JavaScript 中交换值的 10 种方法.html">
            
                    
                    在 JavaScript 中交换值的 10 种方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.16" data-path="常用的前端JavaScript方法封装.html">
            
                <a href="常用的前端JavaScript方法封装.html">
            
                    
                    常用的前端JavaScript方法封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.17" data-path="异步神器Async-await介绍与填坑.html">
            
                <a href="异步神器Async-await介绍与填坑.html">
            
                    
                    异步神器Async Await介绍与填坑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.18" data-path="灵活运用JS开发技巧.html">
            
                <a href="灵活运用JS开发技巧.html">
            
                    
                    灵活运用JS开发技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.19" data-path="编写高质量可维护的代码：一目了然的注释.html">
            
                <a href="编写高质量可维护的代码：一目了然的注释.html">
            
                    
                    编写高质量可维护的代码：一目了然的注释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.20" data-path="编写高质量可维护的代码：优化逻辑判断.html">
            
                <a href="编写高质量可维护的代码：优化逻辑判断.html">
            
                    
                    编写高质量可维护的代码：优化逻辑判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.21" data-path="编写高质量可维护的代码：优雅命名.html">
            
                <a href="编写高质量可维护的代码：优雅命名.html">
            
                    
                    编写高质量可维护的代码：优雅命名
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.22" data-path="编写高质量可维护的代码：数据建模.html">
            
                <a href="编写高质量可维护的代码：数据建模.html">
            
                    
                    编写高质量可维护的代码：数据建模
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Life Exp</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../life_exp/告别平庸的15个小方法.html">
            
                <a href="../life_exp/告别平庸的15个小方法.html">
            
                    
                    告别平庸的15个小方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../life_exp/日志记录.html">
            
                <a href="../life_exp/日志记录.html">
            
                    
                    日志记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../life_exp/程序员的发展方向.html">
            
                <a href="../life_exp/程序员的发展方向.html">
            
                    
                    程序员的发展方向
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../message/">
            
                <a href="../message/">
            
                    
                    Message
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Technology</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../technology/WebSocket.html">
            
                <a href="../technology/WebSocket.html">
            
                    
                    WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../technology/npm常用命令大全.html">
            
                <a href="../technology/npm常用命令大全.html">
            
                    
                    Npm常用命令大全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../technology/智能照明项目说明.html">
            
                <a href="../technology/智能照明项目说明.html">
            
                    
                    智能照明项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../technology/规范化git的提交信息.html">
            
                <a href="../technology/规范化git的提交信息.html">
            
                    
                    规范化Git的提交信息
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Tutorial</li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../tutorial/Esmap地图详解.html">
            
                <a href="../tutorial/Esmap地图详解.html">
            
                    
                    Esmap地图详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../tutorial/npm镜像切换.html">
            
                <a href="../tutorial/npm镜像切换.html">
            
                    
                    Npm镜像切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="../tutorial/发布npm的教程.html">
            
                <a href="../tutorial/发布npm的教程.html">
            
                    
                    发布Npm的教程
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >This、Apply、Call、Bind</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#this&#x3001;apply&#x3001;call&#x3001;bind"><b>1. </b>this&#x3001;apply&#x3001;call&#x3001;bind</a></li><ul><ul><li><span class="title-icon "></span><a href="#this-&#x7684;&#x6307;&#x5411;"><b>1.1.1. </b>this &#x7684;&#x6307;&#x5411;</a></li><li><span class="title-icon "></span><a href="#&#x600E;&#x4E48;&#x6539;&#x53D8;-this-&#x7684;&#x6307;&#x5411;"><b>1.1.2. </b>&#x600E;&#x4E48;&#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;</a></li><li><span class="title-icon "></span><a href="#&#x7BAD;&#x5934;&#x51FD;&#x6570;"><b>1.1.3. </b>&#x7BAD;&#x5934;&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528;-this--this"><b>1.1.4. </b>&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528; _this = this</a></li><li><span class="title-icon "></span><a href="#&#x4F7F;&#x7528;-apply&#x3001;call&#x3001;bind"><b>1.1.5. </b>&#x4F7F;&#x7528; apply&#x3001;call&#x3001;bind</a></li><li><span class="title-icon "></span><a href="#apply&#x3001;call&#x3001;bind-&#x533A;&#x522B;"><b>1.1.6. </b>apply&#x3001;call&#x3001;bind &#x533A;&#x522B;</a></li><li><span class="title-icon "></span><a href="#apply-&#x548C;-call-&#x7684;&#x533A;&#x522B;"><b>1.1.7. </b>apply &#x548C; call &#x7684;&#x533A;&#x522B;</a></li><li><span class="title-icon "></span><a href="#bind-&#x548C;-apply&#x3001;call-&#x533A;&#x522B;"><b>1.1.8. </b>bind &#x548C; apply&#x3001;call &#x533A;&#x522B;</a></li></ul><li><span class="title-icon "></span><a href="#js-&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;"><b>1.2. </b>JS &#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;</a></li><ul><li><span class="title-icon "></span><a href="#&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;"><b>1.2.1. </b>&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;</a></li><li><span class="title-icon "></span><a href="#&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;"><b>1.2.2. </b>&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;</a></li><li><span class="title-icon "></span><a href="#&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;"><b>1.2.3. </b>&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;"><b>1.2.4. </b>&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;</a></li></ul></ul></ul></div><a href="#this&#x3001;apply&#x3001;call&#x3001;bind" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="this&#x3001;apply&#x3001;call&#x3001;bind"><a name="this&#x3001;apply&#x3001;call&#x3001;bind" class="anchor-navigation-ex-anchor" href="#this&#x3001;apply&#x3001;call&#x3001;bind"><i class="fa fa-link" aria-hidden="true"></i></a>1. this&#x3001;apply&#x3001;call&#x3001;bind</h1>
<p>&#x8FD9;&#x53C8;&#x662F;&#x4E00;&#x4E2A;&#x9762;&#x8BD5;&#x7ECF;&#x5178;&#x95EE;&#x9898;~/(&#x3112;o&#x3112;)/~~&#x4E5F;&#x662F; ES5&#x4E2D;&#x4F17;&#x591A;&#x5751;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#xFF0C;&#x5728; ES6 &#x4E2D;&#x53EF;&#x80FD;&#x4F1A;&#x6781;&#x5927;&#x907F;&#x514D; this &#x4EA7;&#x751F;&#x7684;&#x9519;&#x8BEF;&#xFF0C;&#x4F46;&#x662F;&#x4E3A;&#x4E86;&#x4E00;&#x4E9B;&#x8001;&#x4EE3;&#x7801;&#x7684;&#x7EF4;&#x62A4;&#xFF0C;&#x6700;&#x597D;&#x8FD8;&#x662F;&#x4E86;&#x89E3;&#x4E00;&#x4E0B; this &#x7684;&#x6307;&#x5411;&#x548C; call&#x3001;apply&#x3001;bind &#x4E09;&#x8005;&#x7684;&#x533A;&#x522B;&#x3002;</p>
<h3 id="this-&#x7684;&#x6307;&#x5411;"><a name="this-&#x7684;&#x6307;&#x5411;" class="anchor-navigation-ex-anchor" href="#this-&#x7684;&#x6307;&#x5411;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.1. this &#x7684;&#x6307;&#x5411;</h3>
<p>&#x5728; ES5 &#x4E2D;&#xFF0C;&#x5176;&#x5B9E; this &#x7684;&#x6307;&#x5411;&#xFF0C;&#x59CB;&#x7EC8;&#x575A;&#x6301;&#x4E00;&#x4E2A;&#x539F;&#x7406;&#xFF1A;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#xFF0C;&#x6765;&#xFF0C;&#x8DDF;&#x7740;&#x6211;&#x6717;&#x8BFB;&#x4E09;&#x904D;&#xFF1A;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x3002;&#x8BB0;&#x4F4F;&#x8FD9;&#x53E5;&#x8BDD;&#xFF0C;this &#x4F60;&#x5DF2;&#x7ECF;&#x4E86;&#x89E3;&#x4E00;&#x534A;&#x4E86;&#x3002;</p>
<p><strong>&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4E00;&#x4E2A;&#x6700;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;&#x4F8B;1&#xFF1A;</strong></p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">a</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;Cherry&quot;</span>;

        <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);          <span class="hljs-comment">// windowsName</span>

        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;inner:&quot;</span> + <span class="hljs-keyword">this</span>);    <span class="hljs-comment">// inner: Window</span>
    }
    a();
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;outer:&quot;</span> + <span class="hljs-keyword">this</span>)         <span class="hljs-comment">// outer: Window</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x76F8;&#x4FE1;&#x5927;&#x5BB6;&#x90FD;&#x77E5;&#x9053;&#x4E3A;&#x4EC0;&#x4E48; log &#x7684;&#x662F; windowsName&#xFF0C;&#x56E0;&#x4E3A;&#x6839;&#x636E;&#x521A;&#x521A;&#x7684;&#x90A3;&#x53E5;&#x8BDD;&#x201C;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x201D;&#xFF0C;&#x6211;&#x4EEC;&#x770B;&#x6700;&#x540E;&#x8C03;&#x7528; <code>a</code> &#x7684;&#x5730;&#x65B9; <code>a();</code>&#xFF0C;&#x524D;&#x9762;&#x6CA1;&#x6709;&#x8C03;&#x7528;&#x7684;&#x5BF9;&#x8C61;&#x90A3;&#x4E48;&#x5C31;&#x662F;&#x5168;&#x5C40;&#x5BF9;&#x8C61; window&#xFF0C;&#x8FD9;&#x5C31;&#x76F8;&#x5F53;&#x4E8E;&#x662F; <code>window.a()</code>&#xFF1B;&#x6CE8;&#x610F;&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x4F7F;&#x7528;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#xFF0C;&#x5982;&#x679C;&#x4F7F;&#x7528;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x7684;&#x8BDD;&#xFF0C;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#x5C31;&#x662F; <code>undefined</code>&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x4F1A;&#x62A5;&#x9519; <code>Uncaught TypeError: Cannot read property &apos;name&apos; of undefined</code>&#x3002;</p>
<p><strong>&#x518D;&#x770B;&#x4E0B;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;&#x4F8B;2&#xFF1A;</strong></p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// Cherry</span>
        }
    }
    a.fn();
</code></pre>
<p>&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#xFF0C;&#x51FD;&#x6570; fn &#x662F;&#x5BF9;&#x8C61; a &#x8C03;&#x7528;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x6253;&#x5370;&#x7684;&#x503C;&#x5C31;&#x662F; a &#x4E2D;&#x7684; name &#x7684;&#x503C;&#x3002;&#x662F;&#x4E0D;&#x662F;&#x6709;&#x4E00;&#x70B9;&#x6E05;&#x6670;&#x4E86;&#x5462;~</p>
<p><strong>&#x6211;&#x4EEC;&#x505A;&#x4E00;&#x4E2A;&#x5C0F;&#x5C0F;&#x7684;&#x6539;&#x52A8;&#xFF1A;&#x4F8B;3&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// Cherry</span>
        }
    }
    <span class="hljs-built_in">window</span>.a.fn();
</code></pre>
<p>&#x8FD9;&#x91CC;&#x6253;&#x5370; Cherry &#x7684;&#x539F;&#x56E0;&#x4E5F;&#x662F;&#x56E0;&#x4E3A;&#x521A;&#x521A;&#x90A3;&#x53E5;&#x8BDD;&#x201C;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x201D;&#xFF0C;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x5BF9;&#x8C61;&#x4ECD;&#x7136;&#x662F;&#x5BF9;&#x8C61; a&#x3002;</p>
<p><strong>&#x6211;&#x4EEC;&#x518D;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;&#x4F8B;4&#xFF1A;</strong></p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-comment">// name: &quot;Cherry&quot;,</span>
        fn : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// undefined</span>
        }
    }
    <span class="hljs-built_in">window</span>.a.fn();
</code></pre>
<p>&#x8FD9;&#x91CC;&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x6253;&#x5370; <code>undefined</code> &#x5462;&#xFF1F;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x6B63;&#x5982;&#x521A;&#x521A;&#x6240;&#x63CF;&#x8FF0;&#x7684;&#x90A3;&#x6837;&#xFF0C;&#x8C03;&#x7528; fn &#x7684;&#x662F; a &#x5BF9;&#x8C61;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4; fn &#x7684;&#x5185;&#x90E8;&#x7684; this &#x662F;&#x5BF9;&#x8C61; a&#xFF0C;&#x800C;&#x5BF9;&#x8C61; a &#x4E2D;&#x5E76;&#x6CA1;&#x6709;&#x5BF9; name &#x8FDB;&#x884C;&#x5B9A;&#x4E49;&#xFF0C;&#x6240;&#x4EE5; log &#x7684; <code>this.name</code> &#x7684;&#x503C;&#x662F; <code>undefined</code>&#x3002;</p>
<p>&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x8FD8;&#x662F;&#x8BF4;&#x660E;&#x4E86;&#xFF1A;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#xFF0C;&#x56E0;&#x4E3A;&#x6700;&#x540E;&#x8C03;&#x7528; fn &#x7684;&#x5BF9;&#x8C61;&#x662F; a&#xFF0C;&#x6240;&#x4EE5;&#x5C31;&#x7B97; a &#x4E2D;&#x6CA1;&#x6709; name &#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#xFF0C;&#x4E5F;&#x4E0D;&#x4F1A;&#x7EE7;&#x7EED;&#x5411;&#x4E0A;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x5BFB;&#x627E; <code>this.name</code>&#xFF0C;&#x800C;&#x662F;&#x76F4;&#x63A5;&#x8F93;&#x51FA; <code>undefined</code>&#x3002;</p>
<p><strong>&#x518D;&#x6765;&#x770B;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x5751;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;&#x4F8B; 5&#xFF1A;</strong></p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-literal">null</span>,
        <span class="hljs-comment">// name: &quot;Cherry&quot;,</span>
        fn : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// windowsName</span>
        }
    }

    <span class="hljs-keyword">var</span> f = a.fn;
    f();
</code></pre>
<p>&#x8FD9;&#x91CC;&#x4F60;&#x53EF;&#x80FD;&#x4F1A;&#x6709;&#x7591;&#x95EE;&#xFF0C;&#x4E3A;&#x4EC0;&#x4E48;&#x4E0D;&#x662F; <code>Cherry</code>&#xFF0C;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x867D;&#x7136;&#x5C06; a &#x5BF9;&#x8C61;&#x7684; fn &#x65B9;&#x6CD5;&#x8D4B;&#x503C;&#x7ED9;&#x53D8;&#x91CF; f &#x4E86;&#xFF0C;&#x4F46;&#x662F;&#x6CA1;&#x6709;&#x8C03;&#x7528;&#xFF0C;&#x518D;&#x63A5;&#x7740;&#x8DDF;&#x6211;&#x5FF5;&#x8FD9;&#x4E00;&#x53E5;&#x8BDD;&#xFF1A;&#x201C;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x201D;&#xFF0C;&#x7531;&#x4E8E;&#x521A;&#x521A;&#x7684; f &#x5E76;&#x6CA1;&#x6709;&#x8C03;&#x7528;&#xFF0C;&#x6240;&#x4EE5; <code>fn()</code> &#x6700;&#x540E;&#x4ECD;&#x7136;&#x662F;&#x88AB; window &#x8C03;&#x7528;&#x7684;&#x3002;&#x6240;&#x4EE5; this &#x6307;&#x5411;&#x7684;&#x4E5F;&#x5C31;&#x662F; window&#x3002;</p>
<p>&#x7531;&#x4EE5;&#x4E0A;&#x4E94;&#x4E2A;&#x4F8B;&#x5B50;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;this &#x7684;&#x6307;&#x5411;&#x5E76;&#x4E0D;&#x662F;&#x5728;&#x521B;&#x5EFA;&#x7684;&#x65F6;&#x5019;&#x5C31;&#x53EF;&#x4EE5;&#x786E;&#x5B9A;&#x7684;&#xFF0C;&#x5728; es5 &#x4E2D;&#xFF0C;&#x6C38;&#x8FDC;&#x662F;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x3002;</p>
<p><strong>&#x518D;&#x6765;&#x770B;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;&#x4F8B; 6&#xFF1A;</strong></p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fn</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-keyword">var</span> name = <span class="hljs-string">&apos;Cherry&apos;</span>;
        innerFunction();
        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">innerFunction</span>(<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// windowsName</span>
        }
    }

    fn()
</code></pre>
<p>&#x8BFB;&#x5230;&#x73B0;&#x5728;&#x4E86;&#x5E94;&#x8BE5;&#x80FD;&#x591F;&#x7406;&#x89E3;&#x8FD9;&#x662F;&#x4E3A;&#x4EC0;&#x4E48;&#x4E86;&#x5427;(o&#xFF9F;&#x25BD;&#xFF9F;)o&#x3002;</p>
<h3 id="&#x600E;&#x4E48;&#x6539;&#x53D8;-this-&#x7684;&#x6307;&#x5411;"><a name="&#x600E;&#x4E48;&#x6539;&#x53D8;-this-&#x7684;&#x6307;&#x5411;" class="anchor-navigation-ex-anchor" href="#&#x600E;&#x4E48;&#x6539;&#x53D8;-this-&#x7684;&#x6307;&#x5411;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.2. &#x600E;&#x4E48;&#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;</h3>
<p>&#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;&#x6211;&#x603B;&#x7ED3;&#x6709;&#x4EE5;&#x4E0B;&#x51E0;&#x79CD;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ul>
<li>&#x4F7F;&#x7528; ES6 &#x7684;&#x7BAD;&#x5934;&#x51FD;&#x6570;</li>
<li>&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528; <code>_this = this</code></li>
<li>&#x4F7F;&#x7528; <code>apply</code>&#x3001;<code>call</code>&#x3001;<code>bind</code></li>
<li>new &#x5B9E;&#x4F8B;&#x5316;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;</li>
</ul>
<p>&#x4F8B;7&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)     
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            },<span class="hljs-number">100</span>);
        }

    };

    a.func2()     <span class="hljs-comment">// this.func1 is not a function</span>
</code></pre>
<p>&#x5728;&#x4E0D;&#x4F7F;&#x7528;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x662F;&#x4F1A;&#x62A5;&#x9519;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x6700;&#x540E;&#x8C03;&#x7528; <code>setTimeout</code> &#x7684;&#x5BF9;&#x8C61;&#x662F; window&#xFF0C;&#x4F46;&#x662F;&#x5728; window &#x4E2D;&#x5E76;&#x6CA1;&#x6709; func1 &#x51FD;&#x6570;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5728;&#x6539;&#x53D8; this &#x6307;&#x5411;&#x8FD9;&#x4E00;&#x8282;&#x5C06;&#x628A;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4F5C;&#x4E3A; demo &#x8FDB;&#x884C;&#x6539;&#x9020;&#x3002;</p>
<h3 id="&#x7BAD;&#x5934;&#x51FD;&#x6570;"><a name="&#x7BAD;&#x5934;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x7BAD;&#x5934;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.3. &#x7BAD;&#x5934;&#x51FD;&#x6570;</h3>
<p>&#x4F17;&#x6240;&#x5468;&#x77E5;&#xFF0C;ES6 &#x7684;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x662F;&#x53EF;&#x4EE5;&#x907F;&#x514D; ES5 &#x4E2D;&#x4F7F;&#x7528; this &#x7684;&#x5751;&#x7684;&#x3002;<strong>&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x7684; this &#x59CB;&#x7EC8;&#x6307;&#x5411;&#x51FD;&#x6570;&#x5B9A;&#x4E49;&#x65F6;&#x7684; this&#xFF0C;&#x800C;&#x975E;&#x6267;&#x884C;&#x65F6;&#x3002;</strong>&#xFF0C;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x9700;&#x8981;&#x8BB0;&#x7740;&#x8FD9;&#x53E5;&#x8BDD;&#xFF1A;&#x201C;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x4E2D;&#x6CA1;&#x6709; this &#x7ED1;&#x5B9A;&#xFF0C;&#x5FC5;&#x987B;&#x901A;&#x8FC7;&#x67E5;&#x627E;&#x4F5C;&#x7528;&#x57DF;&#x94FE;&#x6765;&#x51B3;&#x5B9A;&#x5176;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x88AB;&#x975E;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x5305;&#x542B;&#xFF0C;&#x5219; this &#x7ED1;&#x5B9A;&#x7684;&#x662F;&#x6700;&#x8FD1;&#x4E00;&#x5C42;&#x975E;&#x7BAD;&#x5934;&#x51FD;&#x6570;&#x7684; this&#xFF0C;&#x5426;&#x5219;&#xFF0C;this &#x4E3A; undefined&#x201D;&#x3002;</p>
<p>&#x4F8B; 8 &#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)     
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout( <span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {
                <span class="hljs-keyword">this</span>.func1()
            },<span class="hljs-number">100</span>);
        }

    };

    a.func2()     <span class="hljs-comment">// Cherry</span>
</code></pre>
<h3 id="&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528;-this--this"><a name="&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528;-this--this" class="anchor-navigation-ex-anchor" href="#&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528;-this--this"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.4. &#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x4F7F;&#x7528; _this = this</h3>
<p>&#x5982;&#x679C;&#x4E0D;&#x4F7F;&#x7528; ES6&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x5E94;&#x8BE5;&#x662F;&#x6700;&#x7B80;&#x5355;&#x7684;&#x4E0D;&#x4F1A;&#x51FA;&#x9519;&#x7684;&#x65B9;&#x5F0F;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x662F;&#x5148;&#x5C06;&#x8C03;&#x7528;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x7684;&#x5BF9;&#x8C61;&#x4FDD;&#x5B58;&#x5728;&#x53D8;&#x91CF; <code>_this</code> &#x4E2D;&#xFF0C;&#x7136;&#x540E;&#x5728;&#x51FD;&#x6570;&#x4E2D;&#x90FD;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A; <code>_this</code>&#xFF0C;&#x8FD9;&#x6837; <code>_this</code> &#x5C31;&#x4E0D;&#x4F1A;&#x6539;&#x53D8;&#x4E86;&#x3002;</p>
<p>&#x4F8B; 9&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-keyword">var</span> a = {

        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)     
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-keyword">var</span> _this = <span class="hljs-keyword">this</span>;
            setTimeout( <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
                _this.func1()
            },<span class="hljs-number">100</span>);
        }

    };

    a.func2()       <span class="hljs-comment">// Cherry</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#xFF0C;&#x5728; func2 &#x4E2D;&#xFF0C;&#x9996;&#x5148;&#x8BBE;&#x7F6E; <code>var _this = this;</code>&#xFF0C;&#x8FD9;&#x91CC;&#x7684; <code>this</code> &#x662F;&#x8C03;&#x7528; <code>func2</code> &#x7684;&#x5BF9;&#x8C61; a&#xFF0C;&#x4E3A;&#x4E86;&#x9632;&#x6B62;&#x5728; <code>func2</code> &#x4E2D;&#x7684; setTimeout &#x88AB; window &#x8C03;&#x7528;&#x800C;&#x5BFC;&#x81F4;&#x7684;&#x5728; setTimeout &#x4E2D;&#x7684; this &#x4E3A; window&#x3002;&#x6211;&#x4EEC;&#x5C06; <code>this(&#x6307;&#x5411;&#x53D8;&#x91CF; a)</code> &#x8D4B;&#x503C;&#x7ED9;&#x4E00;&#x4E2A;&#x53D8;&#x91CF; <code>_this</code>&#xFF0C;&#x8FD9;&#x6837;&#xFF0C;&#x5728; <code>func2</code> &#x4E2D;&#x6211;&#x4EEC;&#x4F7F;&#x7528; <code>_this</code> &#x5C31;&#x662F;&#x6307;&#x5411;&#x5BF9;&#x8C61; a &#x4E86;&#x3002;</p>
<h3 id="&#x4F7F;&#x7528;-apply&#x3001;call&#x3001;bind"><a name="&#x4F7F;&#x7528;-apply&#x3001;call&#x3001;bind" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;-apply&#x3001;call&#x3001;bind"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.5. &#x4F7F;&#x7528; apply&#x3001;call&#x3001;bind</h3>
<p>&#x4F7F;&#x7528; apply&#x3001;call&#x3001;bind &#x51FD;&#x6570;&#x4E5F;&#x662F;&#x53EF;&#x4EE5;&#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;&#x7684;&#xFF0C;&#x539F;&#x7406;&#x7A0D;&#x540E;&#x518D;&#x8BB2;&#xFF0C;&#x6211;&#x4EEC;&#x5148;&#x6765;&#x770B;&#x4E00;&#x4E0B;&#x662F;&#x600E;&#x4E48;&#x5B9E;&#x73B0;&#x7684;&#xFF1A;</p>
<h5 id="&#x4F7F;&#x7528;-apply"><a name="&#x4F7F;&#x7528;-apply" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;-apply"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528; apply</h5>
<p>&#x4F8B;10&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            }.apply(a),<span class="hljs-number">100</span>);
        }

    };

    a.func2()            <span class="hljs-comment">// Cherry</span>
</code></pre>
<h5 id="&#x4F7F;&#x7528;-call"><a name="&#x4F7F;&#x7528;-call" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;-call"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528; call</h5>
<p>&#x4F8B;11&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            }.call(a),<span class="hljs-number">100</span>);
        }

    };

    a.func2()            <span class="hljs-comment">// Cherry</span>
</code></pre>
<h5 id="&#x4F7F;&#x7528;-bind"><a name="&#x4F7F;&#x7528;-bind" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;-bind"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F7F;&#x7528; bind</h5>
<p>&#x4F8B;12&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            }.bind(a)(),<span class="hljs-number">100</span>);
        }

    };

    a.func2()            <span class="hljs-comment">// Cherry</span>
</code></pre>
<h3 id="apply&#x3001;call&#x3001;bind-&#x533A;&#x522B;"><a name="apply&#x3001;call&#x3001;bind-&#x533A;&#x522B;" class="anchor-navigation-ex-anchor" href="#apply&#x3001;call&#x3001;bind-&#x533A;&#x522B;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.6. apply&#x3001;call&#x3001;bind &#x533A;&#x522B;</h3>
<p>&#x521A;&#x521A;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x4ECB;&#x7ECD;&#x4E86; apply&#x3001;call&#x3001;bind &#x90FD;&#x662F;&#x53EF;&#x4EE5;&#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;&#x7684;&#xFF0C;&#x4F46;&#x662F;&#x8FD9;&#x4E09;&#x4E2A;&#x51FD;&#x6570;&#x7A0D;&#x6709;&#x4E0D;&#x540C;&#x3002;</p>
<p>&#x5728; <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" target="_blank">MDN</a> &#x4E2D;&#x5B9A;&#x4E49; apply &#x5982;&#x4E0B;&#xFF1B;</p>
<blockquote>
<p>apply() &#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x4E00;&#x4E2A;&#x51FD;&#x6570;, &#x5176;&#x5177;&#x6709;&#x4E00;&#x4E2A;&#x6307;&#x5B9A;&#x7684;this&#x503C;&#xFF0C;&#x4EE5;&#x53CA;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#xFF08;&#x6216;&#x7C7B;&#x4F3C;&#x6570;&#x7EC4;&#x7684;&#x5BF9;&#x8C61;&#xFF09;&#x63D0;&#x4F9B;&#x7684;&#x53C2;&#x6570;</p>
</blockquote>
<p>&#x8BED;&#x6CD5;&#xFF1A;</p>
<blockquote>
<p>fun.apply(thisArg, [argsArray])</p>
</blockquote>
<ul>
<li>thisArg&#xFF1A;&#x5728; fun &#x51FD;&#x6570;&#x8FD0;&#x884C;&#x65F6;&#x6307;&#x5B9A;&#x7684; this &#x503C;&#x3002;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x6307;&#x5B9A;&#x7684; this &#x503C;&#x5E76;&#x4E0D;&#x4E00;&#x5B9A;&#x662F;&#x8BE5;&#x51FD;&#x6570;&#x6267;&#x884C;&#x65F6;&#x771F;&#x6B63;&#x7684; this &#x503C;&#xFF0C;&#x5982;&#x679C;&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x5904;&#x4E8E;&#x975E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x4E0B;&#xFF0C;&#x5219;&#x6307;&#x5B9A;&#x4E3A; null &#x6216; undefined &#x65F6;&#x4F1A;&#x81EA;&#x52A8;&#x6307;&#x5411;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#xFF08;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x5C31;&#x662F;window&#x5BF9;&#x8C61;&#xFF09;&#xFF0C;&#x540C;&#x65F6;&#x503C;&#x4E3A;&#x539F;&#x59CB;&#x503C;&#xFF08;&#x6570;&#x5B57;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5E03;&#x5C14;&#x503C;&#xFF09;&#x7684; this &#x4F1A;&#x6307;&#x5411;&#x8BE5;&#x539F;&#x59CB;&#x503C;&#x7684;&#x81EA;&#x52A8;&#x5305;&#x88C5;&#x5BF9;&#x8C61;&#x3002;</li>
<li>argsArray&#xFF1A;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#x6216;&#x8005;&#x7C7B;&#x6570;&#x7EC4;&#x5BF9;&#x8C61;&#xFF0C;&#x5176;&#x4E2D;&#x7684;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x5C06;&#x4F5C;&#x4E3A;&#x5355;&#x72EC;&#x7684;&#x53C2;&#x6570;&#x4F20;&#x7ED9; fun &#x51FD;&#x6570;&#x3002;&#x5982;&#x679C;&#x8BE5;&#x53C2;&#x6570;&#x7684;&#x503C;&#x4E3A;null &#x6216; undefined&#xFF0C;&#x5219;&#x8868;&#x793A;&#x4E0D;&#x9700;&#x8981;&#x4F20;&#x5165;&#x4EFB;&#x4F55;&#x53C2;&#x6570;&#x3002;&#x4ECE;ECMAScript 5 &#x5F00;&#x59CB;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7C7B;&#x6570;&#x7EC4;&#x5BF9;&#x8C61;&#x3002;&#x6D4F;&#x89C8;&#x5668;&#x517C;&#x5BB9;&#x6027;&#x8BF7;&#x53C2;&#x9605;&#x672C;&#x6587;&#x5E95;&#x90E8;&#x5185;&#x5BB9;&#x3002;</li>
</ul>
<h3 id="apply-&#x548C;-call-&#x7684;&#x533A;&#x522B;"><a name="apply-&#x548C;-call-&#x7684;&#x533A;&#x522B;" class="anchor-navigation-ex-anchor" href="#apply-&#x548C;-call-&#x7684;&#x533A;&#x522B;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.7. apply &#x548C; call &#x7684;&#x533A;&#x522B;</h3>
<p>&#x5176;&#x5B9E; apply &#x548C; call &#x57FA;&#x672C;&#x7C7B;&#x4F3C;&#xFF0C;&#x4ED6;&#x4EEC;&#x7684;&#x533A;&#x522B;&#x53EA;&#x662F;&#x4F20;&#x5165;&#x7684;&#x53C2;&#x6570;&#x4E0D;&#x540C;&#x3002;</p>
<p>call &#x7684;&#x8BED;&#x6CD5;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-javascript">fun.call(thisArg[, arg1[, arg2[, ...]]])
</code></pre>
<p>&#x6240;&#x4EE5; apply &#x548C; call &#x7684;&#x533A;&#x522B;&#x662F; call &#x65B9;&#x6CD5;&#x63A5;&#x53D7;&#x7684;&#x662F;&#x82E5;&#x5E72;&#x4E2A;&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF0C;&#x800C; apply &#x63A5;&#x6536;&#x7684;&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x53C2;&#x6570;&#x7684;&#x6570;&#x7EC4;&#x3002;</p>
<p>&#x4F8B;13&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a ={
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">a,b</span>) </span>{
            <span class="hljs-built_in">console</span>.log( a + b)
        }
    }

    <span class="hljs-keyword">var</span> b = a.fn;
    b.apply(a,[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>])     <span class="hljs-comment">// 3</span>
</code></pre>
<p>&#x4F8B;14&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a ={
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">a,b</span>) </span>{
            <span class="hljs-built_in">console</span>.log( a + b)
        }
    }

    <span class="hljs-keyword">var</span> b = a.fn;
    b.call(a,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>)       <span class="hljs-comment">// 3</span>
</code></pre>
<h3 id="bind-&#x548C;-apply&#x3001;call-&#x533A;&#x522B;"><a name="bind-&#x548C;-apply&#x3001;call-&#x533A;&#x522B;" class="anchor-navigation-ex-anchor" href="#bind-&#x548C;-apply&#x3001;call-&#x533A;&#x522B;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.8. bind &#x548C; apply&#x3001;call &#x533A;&#x522B;</h3>
<p>&#x6211;&#x4EEC;&#x5148;&#x6765;&#x5C06;&#x521A;&#x521A;&#x7684;&#x4F8B;&#x5B50;&#x4F7F;&#x7528; bind &#x8BD5;&#x4E00;&#x4E0B;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a ={
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">a,b</span>) </span>{
            <span class="hljs-built_in">console</span>.log( a + b)
        }
    }

    <span class="hljs-keyword">var</span> b = a.fn;
    b.bind(a,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>)
</code></pre>
<p>&#x6211;&#x4EEC;&#x4F1A;&#x53D1;&#x73B0;&#x5E76;&#x6CA1;&#x6709;&#x8F93;&#x51FA;&#xFF0C;&#x8FD9;&#x662F;&#x4E3A;&#x4EC0;&#x4E48;&#x5462;&#xFF0C;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x4E00;&#x4E0B; <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/bind" target="_blank">MDN</a> &#x4E0A;&#x7684;&#x6587;&#x6863;&#x8BF4;&#x660E;&#xFF1A;</p>
<blockquote>
<p>bind()&#x65B9;&#x6CD5;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x51FD;&#x6570;, &#x5F53;&#x88AB;&#x8C03;&#x7528;&#x65F6;&#xFF0C;&#x5C06;&#x5176;this&#x5173;&#x952E;&#x5B57;&#x8BBE;&#x7F6E;&#x4E3A;&#x63D0;&#x4F9B;&#x7684;&#x503C;&#xFF0C;&#x5728;&#x8C03;&#x7528;&#x65B0;&#x51FD;&#x6570;&#x65F6;&#xFF0C;&#x5728;&#x4EFB;&#x4F55;&#x63D0;&#x4F9B;&#x4E4B;&#x524D;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x7ED9;&#x5B9A;&#x7684;&#x53C2;&#x6570;&#x5E8F;&#x5217;&#x3002;</p>
</blockquote>
<p>&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#xFF0C;bind &#x662F;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x6211;&#x4EEC;&#x5FC5;&#x987B;&#x8981;&#x624B;&#x52A8;&#x53BB;&#x8C03;&#x7528;&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> a ={
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">a,b</span>) </span>{
            <span class="hljs-built_in">console</span>.log( a + b)
        }
    }

    <span class="hljs-keyword">var</span> b = a.fn;
    b.bind(a,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>)()           <span class="hljs-comment">// 3</span>
</code></pre>
<h2 id="js-&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;"><a name="js-&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;" class="anchor-navigation-ex-anchor" href="#js-&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. JS &#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;</h2>
<p>&#x770B;&#x5230;&#x7559;&#x8A00;&#x8BF4;&#xFF0C;&#x5F88;&#x591A;&#x7AE5;&#x9774;&#x4E0D;&#x7406;&#x89E3;&#x4E3A;&#x4EC0;&#x4E48; &#x4F8B; 6 &#x7684; innerFunction &#x548C; &#x4F8B; 7 &#x7684; this &#x662F;&#x6307;&#x5411; window &#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x5C31;&#x6765;&#x8865;&#x5145;&#x4E00;&#x4E0B; JS &#x4E2D;&#x7684;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x3002;</p>
<p>&#x4F8B;6&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fn</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-keyword">var</span> name = <span class="hljs-string">&apos;Cherry&apos;</span>;
        innerFunction();
        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">innerFunction</span>(<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// windowsName</span>
        }
    }

    fn()
</code></pre>
<p>&#x4F8B;7&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)     
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            },<span class="hljs-number">100</span>);
        }

    };

    a.func2()     <span class="hljs-comment">// this.func1 is not a function</span>
</code></pre>
<p>&#x51FD;&#x6570;&#x8C03;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#x4E00;&#x5171;&#x6709; 4 &#x79CD;</p>
<ol>
<li>&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;</li>
<li>&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;</li>
<li>&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;</li>
<li>&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;&#xFF08;call&#x3001;apply&#xFF09;</li>
</ol>
<h3 id="&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;"><a name="&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;" class="anchor-navigation-ex-anchor" href="#&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1. &#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;</h3>
<p>&#x6BD4;&#x5982;&#x4E0A;&#x9762;&#x7684; &#x4F8B; 1&#xFF1A;
&#x4F8B; 1&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">a</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;Cherry&quot;</span>;

        <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);          <span class="hljs-comment">// windowsName</span>

        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;inner:&quot;</span> + <span class="hljs-keyword">this</span>);    <span class="hljs-comment">// inner: Window</span>
    }
    a();
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;outer:&quot;</span> + <span class="hljs-keyword">this</span>)         <span class="hljs-comment">// outer: Window</span>
</code></pre>
<p>&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x6700;&#x7B80;&#x5355;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x4E0D;&#x5C5E;&#x4E8E;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#xFF0C;&#x8FD9;&#x6837;&#x7684;&#x60C5;&#x51B5;&#x5728; JavaScript &#x7684;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x7684;&#x975E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x9ED8;&#x8BA4;&#x662F;&#x5C5E;&#x4E8E;&#x5168;&#x5C40;&#x5BF9;&#x8C61; window &#x7684;&#xFF0C;&#x5728;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#xFF0C;&#x5C31;&#x662F; undefined&#x3002; </p>
<p>&#x4F46;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5F88;&#x5BB9;&#x6613;&#x4EA7;&#x751F;&#x547D;&#x540D;&#x51B2;&#x7A81;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x5EFA;&#x8BAE;&#x8FD9;&#x6837;&#x4F7F;&#x7528;&#x3002;</p>
<h3 id="&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;"><a name="&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.2. &#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x8C03;&#x7528;</h3>
<p>&#x6240;&#x4EE5;&#x8BF4;&#x66F4;&#x591A;&#x7684;&#x60C5;&#x51B5;&#x662F;&#x5C06;&#x51FD;&#x6570;&#x4F5C;&#x4E3A;&#x5BF9;&#x8C61;&#x7684;&#x65B9;&#x6CD5;&#x4F7F;&#x7528;&#x3002;&#x6BD4;&#x5982;&#x4F8B; 2&#xFF1A;
&#x4F8B; 2&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;
    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span>: <span class="hljs-string">&quot;Cherry&quot;</span>,
        <span class="hljs-attr">fn</span> : <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// Cherry</span>
        }
    }
    a.fn();
</code></pre>
<p>&#x8FD9;&#x91CC;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61; <code>a</code>&#xFF0C;&#x5BF9;&#x8C61; <code>a</code> &#x6709;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#xFF08;<code>name</code>&#xFF09;&#x548C;&#x4E00;&#x4E2A;&#x65B9;&#x6CD5;&#xFF08;<code>fn</code>&#xFF09;&#x3002;</p>
<p>&#x7136;&#x540E;&#x5BF9;&#x8C61; <code>a</code> &#x901A;&#x8FC7; <code>.</code> &#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x4E86;&#x5176;&#x4E2D;&#x7684; fn &#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x4E00;&#x76F4;&#x8BB0;&#x4F4F;&#x7684;&#x90A3;&#x53E5;&#x8BDD;&#x201C;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#x201D;&#xFF0C;&#x6240;&#x4EE5;&#x5728; fn &#x4E2D;&#x7684; this &#x5C31;&#x662F;&#x6307;&#x5411; a &#x7684;&#x3002;</p>
<h3 id="&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;"><a name="&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.3. &#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x51FD;&#x6570;</h3>
<blockquote>
<p>&#x5982;&#x679C;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x524D;&#x4F7F;&#x7528;&#x4E86; new &#x5173;&#x952E;&#x5B57;, &#x5219;&#x662F;&#x8C03;&#x7528;&#x4E86;&#x6784;&#x9020;&#x51FD;&#x6570;&#x3002;
&#x8FD9;&#x770B;&#x8D77;&#x6765;&#x5C31;&#x50CF;&#x521B;&#x5EFA;&#x4E86;&#x65B0;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x4F46;&#x5B9E;&#x9645;&#x4E0A; JavaScript &#x51FD;&#x6570;&#x662F;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x7684;&#x5BF9;&#x8C61;&#xFF1A;</p>
</blockquote>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x6784;&#x9020;&#x51FD;&#x6570;:</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">myFunction</span>(<span class="hljs-params">arg1, arg2</span>) </span>{
    <span class="hljs-keyword">this</span>.firstName = arg1;
    <span class="hljs-keyword">this</span>.lastName  = arg2;
}

<span class="hljs-comment">// This    creates a new object</span>
<span class="hljs-keyword">var</span> a = <span class="hljs-keyword">new</span> myFunction(<span class="hljs-string">&quot;Li&quot;</span>,<span class="hljs-string">&quot;Cherry&quot;</span>);
a.lastName;                             <span class="hljs-comment">// &#x8FD4;&#x56DE; &quot;Cherry&quot;</span>
</code></pre>
<p>&#x8FD9;&#x5C31;&#x6709;&#x8981;&#x8BF4;&#x53E6;&#x4E00;&#x4E2A;&#x9762;&#x8BD5;&#x7ECF;&#x5178;&#x95EE;&#x9898;&#xFF1A;new &#x7684;&#x8FC7;&#x7A0B;&#x4E86;&#xFF0C;(&#xCA5;_&#xCA5;)
&#x8FD9;&#x91CC;&#x5C31;&#x7B80;&#x5355;&#x7684;&#x6765;&#x770B;&#x4E00;&#x4E0B; new &#x7684;&#x8FC7;&#x7A0B;&#x5427;&#xFF1A;
&#x4F2A;&#x4EE3;&#x7801;&#x8868;&#x793A;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> a = <span class="hljs-keyword">new</span> myFunction(<span class="hljs-string">&quot;Li&quot;</span>,<span class="hljs-string">&quot;Cherry&quot;</span>);

<span class="hljs-keyword">new</span> myFunction{
    <span class="hljs-keyword">var</span> obj = {};
    obj.__proto__ = myFunction.prototype;
    <span class="hljs-keyword">var</span> result = myFunction.call(obj,<span class="hljs-string">&quot;Li&quot;</span>,<span class="hljs-string">&quot;Cherry&quot;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">typeof</span> result === <span class="hljs-string">&apos;obj&apos;</span>? result : obj;
}
</code></pre>
<ol>
<li>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7A7A;&#x5BF9;&#x8C61; obj;</li>
<li>&#x5C06;&#x65B0;&#x521B;&#x5EFA;&#x7684;&#x7A7A;&#x5BF9;&#x8C61;&#x7684;&#x9690;&#x5F0F;&#x539F;&#x578B;&#x6307;&#x5411;&#x5176;&#x6784;&#x9020;&#x51FD;&#x6570;&#x7684;&#x663E;&#x793A;&#x539F;&#x578B;&#x3002;</li>
<li>&#x4F7F;&#x7528; call &#x6539;&#x53D8; this &#x7684;&#x6307;&#x5411;</li>
<li>&#x5982;&#x679C;&#x65E0;&#x8FD4;&#x56DE;&#x503C;&#x6216;&#x8005;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x975E;&#x5BF9;&#x8C61;&#x503C;&#xFF0C;&#x5219;&#x5C06; obj &#x8FD4;&#x56DE;&#x4F5C;&#x4E3A;&#x65B0;&#x5BF9;&#x8C61;&#xFF1B;&#x5982;&#x679C;&#x8FD4;&#x56DE;&#x503C;&#x662F;&#x4E00;&#x4E2A;&#x65B0;&#x5BF9;&#x8C61;&#x7684;&#x8BDD;&#x90A3;&#x4E48;&#x76F4;&#x63A5;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;&#x8BE5;&#x5BF9;&#x8C61;&#x3002;</li>
</ol>
<p>&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;&#x5728; new &#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x662F;&#x4F7F;&#x7528; call &#x6539;&#x53D8;&#x4E86; this &#x7684;&#x6307;&#x5411;&#x3002;</p>
<h3 id="&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;"><a name="&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.4. &#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x51FD;&#x6570;</h3>
<blockquote>
<p>&#x5728; JavaScript &#x4E2D;, &#x51FD;&#x6570;&#x662F;&#x5BF9;&#x8C61;&#x3002;</p>
<p>JavaScript &#x51FD;&#x6570;&#x6709;&#x5B83;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x3002;
call() &#x548C; apply() &#x662F;&#x9884;&#x5B9A;&#x4E49;&#x7684;&#x51FD;&#x6570;&#x65B9;&#x6CD5;&#x3002; &#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x53EF;&#x7528;&#x4E8E;&#x8C03;&#x7528;&#x51FD;&#x6570;&#xFF0C;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x662F;&#x5BF9;&#x8C61;&#x672C;&#x8EAB;</p>
<p>&#x5728; JavaScript &#x4E25;&#x683C;&#x6A21;&#x5F0F;(strict mode)&#x4E0B;, &#x5728;&#x8C03;&#x7528;&#x51FD;&#x6570;&#x65F6;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4F1A;&#x6210;&#x4E3A; this &#x7684;&#x503C;&#xFF0C; &#x5373;&#x4F7F;&#x8BE5;&#x53C2;&#x6570;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x3002;
&#x5728; JavaScript &#x975E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;(non-strict mode)&#x4E0B;, &#x5982;&#x679C;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x7684;&#x503C;&#x662F; null &#x6216; undefined, &#x5B83;&#x5C06;&#x4F7F;&#x7528;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#x66FF;&#x4EE3;&#x3002;</p>
</blockquote>
<p>&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x518D;&#x6765;&#x770B;&#x4F8B; 6&#xFF1A;</p>
<p>&#x4F8B;6&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fn</span>(<span class="hljs-params"></span>) </span>{
        <span class="hljs-keyword">var</span> name = <span class="hljs-string">&apos;Cherry&apos;</span>;
        innerFunction();
        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">innerFunction</span>(<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name);      <span class="hljs-comment">// windowsName</span>
        }
    }

    fn()
</code></pre>
<p>&#x8FD9;&#x91CC;&#x7684; innerFunction() &#x7684;&#x8C03;&#x7528;&#x662F;&#x4E0D;&#x662F;&#x5C5E;&#x4E8E;&#x7B2C;&#x4E00;&#x79CD;&#x8C03;&#x7528;&#x65B9;&#x5F0F;&#xFF1A;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;&#xFF08;&#x5B83;&#x5C31;&#x662F;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x7684;&#xFF0C;&#x6CA1;&#x6709;&#x6302;&#x8F7D;&#x5728;&#x4EFB;&#x4F55;&#x5BF9;&#x8C61;&#x4E0A;&#xFF0C;&#x6240;&#x4EE5;&#x5BF9;&#x4E8E;&#x6CA1;&#x6709;&#x6302;&#x8F7D;&#x5728;&#x4EFB;&#x4F55;&#x5BF9;&#x8C61;&#x4E0A;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5728;&#x975E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x4E0B; this &#x5C31;&#x662F;&#x6307;&#x5411; window &#x7684;&#xFF09;</p>
<p>&#x7136;&#x540E;&#x518D;&#x770B;&#x4E00;&#x4E0B; &#x4F8B; 7&#xFF1A;
&#x4F8B; 7&#xFF1A;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> name = <span class="hljs-string">&quot;windowsName&quot;</span>;

    <span class="hljs-keyword">var</span> a = {
        <span class="hljs-attr">name</span> : <span class="hljs-string">&quot;Cherry&quot;</span>,

        <span class="hljs-attr">func1</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            <span class="hljs-built_in">console</span>.log(<span class="hljs-keyword">this</span>.name)     
        },

        <span class="hljs-attr">func2</span>: <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
            setTimeout(  <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
                <span class="hljs-keyword">this</span>.func1()
            },<span class="hljs-number">100</span> );
        }

    };

    a.func2()     <span class="hljs-comment">// this.func1 is not a function</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x7B80;&#x5355;&#x4E00;&#x70B9;&#x7684;&#x7406;&#x89E3;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x201C;<strong>&#x533F;&#x540D;&#x51FD;&#x6570;&#x7684; this &#x6C38;&#x8FDC;&#x6307;&#x5411; window</strong>&#x201D;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x60F3;&#xFF0C;&#x8FD8;&#x662F;&#x90A3;&#x53E5;&#x8BDD;<strong>this &#x6C38;&#x8FDC;&#x6307;&#x5411;&#x6700;&#x540E;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x90A3;&#x4E2A;&#x5BF9;&#x8C61;</strong>&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x5C31;&#x6765;&#x627E;&#x6700;&#x540E;&#x8C03;&#x7528;&#x533F;&#x540D;&#x51FD;&#x6570;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x8FD9;&#x5C31;&#x5F88;&#x5C34;&#x5C2C;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A;&#x533F;&#x540D;&#x51FD;&#x6570;&#x540D;&#x5B57;&#x554A;&#xFF0C;&#x7B11;&#x54ED;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x662F;&#x6CA1;&#x6709;&#x529E;&#x6CD5;&#x88AB;&#x5176;&#x4ED6;&#x5BF9;&#x8C61;&#x8C03;&#x7528;&#x533F;&#x540D;&#x51FD;&#x6570;&#x7684;&#x3002;&#x6240;&#x4EE5;&#x8BF4; &#x533F;&#x540D;&#x51FD;&#x6570;&#x7684; this &#x6C38;&#x8FDC;&#x6307;&#x5411; window&#x3002;</p>
<p>&#x5982;&#x679C;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x4F60;&#x8981;&#x95EE;&#xFF0C;&#x90A3;&#x533F;&#x540D;&#x51FD;&#x6570;&#x90FD;&#x662F;&#x600E;&#x4E48;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x9996;&#x5148;&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x5199;&#x7684;&#x533F;&#x540D;&#x51FD;&#x6570;&#x90FD;&#x662F;&#x81EA;&#x6267;&#x884C;&#x7684;&#xFF0C;&#x5C31;&#x662F;&#x5728;&#x533F;&#x540D;&#x51FD;&#x6570;&#x540E;&#x9762;&#x52A0; <code>()</code> &#x8BA9;&#x5176;&#x81EA;&#x6267;&#x884C;&#x3002;&#x5176;&#x6B21;&#x5C31;&#x662F;&#x867D;&#x7136;&#x533F;&#x540D;&#x51FD;&#x6570;&#x4E0D;&#x80FD;&#x88AB;&#x5176;&#x4ED6;&#x5BF9;&#x8C61;&#x8C03;&#x7528;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x4EE5;&#x88AB;&#x5176;&#x4ED6;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x554A;&#xFF0C;&#x6BD4;&#x5982;&#x4F8B; 7 &#x4E2D;&#x7684; setTimeout&#x3002; </p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; zhengyuliang all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x7F16;&#x5199;&#x65F6;&#x95F4;&#xFF1A;
2020-07-30 13:47:35
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="javascript核心知识.html" class="navigation navigation-prev " aria-label="Previous page: Javascript核心知识">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="前端js常用的60余种工具方法.html" class="navigation navigation-next " aria-label="Next page: 前端Js常用的60余种工具方法">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"This、Apply、Call、Bind","level":"4.12","depth":1,"next":{"title":"前端Js常用的60余种工具方法","level":"4.13","depth":1,"path":"javaScript/前端js常用的60余种工具方法.md","ref":"javaScript/前端js常用的60余种工具方法.md","articles":[]},"previous":{"title":"Javascript核心知识","level":"4.11","depth":1,"path":"javaScript/javascript核心知识.md","ref":"javaScript/javascript核心知识.md","articles":[]},"dir":"ltr"},"config":{"plugins":["sectionx","splitter","tbfed-pagefooter","toggle-chapters","theme-comscore","-lunr","-search","search-plus","donate","anchor-navigation-ex","expandable-chapters","chapter-fold","expandable-chapters-small","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy zhengyuliang","modify_label":"该文件编写时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"pluginsConfig":{"anchor-navigation-ex":{"showLevel":false,"showGoTop":true,"isRewritePageTitle":true,"isShowTocTitleIcon":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"}},"livereload":{},"splitter":{},"donate":{"title":"","button":"赏","wechat":"https://gitee.com/htzyl/img_bed/raw/master/pay/weixin-min.jpg","alipay":"https://gitee.com/htzyl/img_bed/raw/master/pay/alipay-min.jpg","wechatText":"微信打赏","alipayText":"支付宝打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"highlight":{},"anchor-navigation-ex":{"showLevel":true,"associatedWithSummary":true,"mode":"float","showGoTop":true,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"theme-comscore":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"zhengyuliang","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"记录技术文档内容","language":"zh-hans","gitbook":">=3.0.0","description":"记录Gitbook的配置和一些插件的使用","theme-default":{"showLevel":true}},"file":{"path":"javaScript/this、apply、call、bind.md","mtime":"2020-07-30T05:47:35.460Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-01-06T09:44:01.178Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

